package com.yxp.webtest.config;

import com.yxp.webtest.intercept.LoginIntercept1;
import com.yxp.webtest.intercept.LoginIntercept2;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author      : yang.xp
 * @date        : 2021/10/11 15:10
 * @description : 通过 java 代码配置的方式来配置拦截器
 */
@Configuration
@EnableWebMvc
public class InterceptConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginIntercept1());
        registry.addInterceptor(new LoginIntercept2());
    }
}
